//
//  SQHomeCollectionViewCell.m
//  energy
//
//  Created by 周曼迪 on 2021/7/6.
//

#import "SQHomeCollectionViewCell.h"
#import "SQHomeModel.h"

@implementation SQHomeCollectionViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
}

//-(void)setModel:(BaseModel<BaseCellModelProtocol> *)model{
//
//}

-(void)setModel:(BaseModel *)model{
    SQHomeModel * homeModel = model;
   
    self.btn_special.hidden = YES;
    self.btn_homework.hidden = YES;
    if ([MLevel isEqualToString:@"1"] ) {
        if (self.indexPath.row == 0) {
            self.lab_title.text = @"安全检查";
            self.lab_subtitle.text = @"security check";
            self.lab_one_name.text = @"作业检查";
            self.lab_two_name.text = @"专项检查";
            self.lab_one_num.text = homeModel.operation_inspection;
            self.lab_two_num.text = homeModel.special_inspection;
            self.btn_special.hidden = NO;
            self.btn_homework.hidden = NO;
            self.img_bg.image = [UIImage imageNamed:@"0"];
        }else if (self.indexPath.row == 1) {
            self.lab_title.text = @"风险公告";
            self.lab_subtitle.text = @"Risk announcement";
            self.lab_one_name.text = @"重大风险";
            self.lab_two_name.text = @"较大风险";
            self.lab_one_num.text = homeModel.major;
            self.lab_two_num.text = homeModel.more;
            self.img_bg.image = [UIImage imageNamed:@"1"];
        }else if (self.indexPath.row == 2) {
            self.lab_title.text = @"隐患列表";
            self.lab_subtitle.text = @"report";
            self.lab_one_name.text = @"上报未确认";
            self.lab_two_name.text = @"上报总数";
            self.img_bg.image = [UIImage imageNamed:@"2"];
            self.lab_one_num.text = homeModel.unconfirmed;
            self.lab_two_num.text = homeModel.total;
        }else if (self.indexPath.row == 3) {
            self.lab_title.text = @"隐患确认";
            self.lab_subtitle.text = @"confirm";
            self.lab_one_name.text = @"任务预警";
            self.lab_two_name.text = @"任务待办";
            self.img_bg.image = [UIImage imageNamed:@"3"];
            self.lab_one_num.text = homeModel.warning_confirm;
            self.lab_two_num.text = homeModel.confirm;
        }
    }else if ( [MLevel isEqualToString:@"4"]){
        if (self.indexPath.row == 0) {
            self.lab_title.text = @"安全检查";
            self.lab_subtitle.text = @"security check";
            self.lab_one_name.text = @"作业检查";
            self.lab_two_name.text = @"专项检查";
            self.btn_special.hidden = NO;
            self.btn_homework.hidden = NO;
            self.lab_one_num.text = homeModel.operation_inspection;
            self.lab_two_num.text = homeModel.special_inspection;
            self.img_bg.image = [UIImage imageNamed:@"0"];
        }else if (self.indexPath.row == 1) {
            self.lab_title.text = @"风险公告";
            self.lab_subtitle.text = @"Risk announcement";
            self.lab_one_name.text = @"重大风险";
            self.lab_two_name.text = @"较大风险";
            self.lab_one_num.text = homeModel.major;
            self.lab_two_num.text = homeModel.more;
            self.img_bg.image = [UIImage imageNamed:@"1"];
        }else if (self.indexPath.row == 2) {
            self.lab_title.text = @"隐患列表";
            self.lab_subtitle.text = @"report";
            self.lab_one_name.text = @"上报未确认";
            self.lab_two_name.text = @"上报总数";
            self.img_bg.image = [UIImage imageNamed:@"2"];
            self.lab_one_num.text = homeModel.unconfirmed;
            self.lab_two_num.text = homeModel.total;
        }else if (self.indexPath.row == 3) {
            self.lab_title.text = @"隐患整改";
            self.lab_subtitle.text = @"rectification";
            self.lab_one_name.text = @"任务预警";
            self.lab_two_name.text = @"任务待办";
            self.img_bg.image = [UIImage imageNamed:@"4"];
            self.lab_one_num.text = homeModel.warning_rectification;
            self.lab_two_num.text = homeModel.rectification;
        }
    }else{
        if (self.indexPath.row == 0) {
            self.lab_title.text = @"安全检查";
            self.lab_subtitle.text = @"security check";
            self.lab_one_name.text = @"作业检查";
            self.lab_two_name.text = @"专项检查";
            self.btn_special.hidden = NO;
            self.btn_homework.hidden = NO;
            self.lab_one_num.text = homeModel.operation_inspection;
            self.lab_two_num.text = homeModel.special_inspection;
            self.img_bg.image = [UIImage imageNamed:@"0"];
        }else if (self.indexPath.row == 1) {
            self.lab_title.text = @"风险公告";
            self.lab_subtitle.text = @"Risk announcement";
            self.lab_one_name.text = @"重大风险";
            self.lab_two_name.text = @"较大风险";
            self.lab_one_num.text = homeModel.major;
            self.lab_two_num.text = homeModel.more;
            self.img_bg.image = [UIImage imageNamed:@"1"];
        }else if (self.indexPath.row == 2) {
            self.lab_title.text = @"隐患列表";
            self.lab_subtitle.text = @"report";
            self.lab_one_name.text = @"上报未确认";
            self.lab_two_name.text = @"上报总数";
            self.img_bg.image = [UIImage imageNamed:@"2"];
            self.lab_one_num.text = homeModel.unconfirmed;
            self.lab_two_num.text = homeModel.total;
        }else if (self.indexPath.row == 3) {
            self.lab_title.text = @"隐患确认";
            self.lab_subtitle.text = @"confirm";
            self.lab_one_name.text = @"任务预警";
            self.lab_two_name.text = @"任务待办";
            self.img_bg.image = [UIImage imageNamed:@"3"];
            self.lab_one_num.text = homeModel.warning_confirm;
            self.lab_two_num.text = homeModel.confirm;
        }else if (self.indexPath.row == 4) {
            self.lab_title.text = @"隐患整改";
            self.lab_subtitle.text = @"rectification";
            self.lab_one_name.text = @"任务预警";
            self.lab_two_name.text = @"任务待办";
            self.img_bg.image = [UIImage imageNamed:@"4"];
            self.lab_one_num.text = homeModel.warning_rectification;
            self.lab_two_num.text = homeModel.rectification;
        }else if (self.indexPath.row == 5) {
            self.lab_title.text = @"隐患验收";
            self.lab_subtitle.text = @"Risk acceptance";
            self.lab_one_name.text = @"任务预警";
            self.lab_two_name.text = @"任务待办";
            self.img_bg.image = [UIImage imageNamed:@"5"];
            self.lab_one_num.text = homeModel.warning_examine;
            self.lab_two_num.text = homeModel.examine;
        }
    }
}

+(CGSize)cellSize:(BaseModel *)model{
    return CGSizeMake(W(187), W(130));
}


- (IBAction)clickCell:(UIButton *)sender {
    self.cellEvent((int)self.indexPath.row, self.lab_title.text);
}

- (IBAction)clickHomework:(UIButton *)sender {
    self.cellEvent((int)self.indexPath.row, self.lab_one_name.text);
}

- (IBAction)clickSpecial:(UIButton *)sender {
    self.cellEvent((int)self.indexPath.row, self.lab_two_name.text);
}

@end
